MODULES := ptlrpc
LDLM := @top_srcdir@/lustre/ldlm/
TARGET := @top_srcdir@/lustre/target/

ldlm_objs := $(LDLM)l_lock.o $(LDLM)ldlm_lock.o
ldlm_objs += $(LDLM)ldlm_resource.o $(LDLM)ldlm_lib.o
ldlm_objs += $(LDLM)ldlm_plain.o $(LDLM)ldlm_extent.o
ldlm_objs += $(LDLM)ldlm_request.o $(LDLM)ldlm_lockd.o
ldlm_objs += $(LDLM)ldlm_flock.o $(LDLM)ldlm_inodebits.o
ldlm_objs += $(LDLM)ldlm_pool.o $(LDLM)ldlm_reclaim.o

target_objs := $(TARGET)tgt_main.o $(TARGET)tgt_lastrcvd.o
target_objs += $(TARGET)tgt_handler.o $(TARGET)out_handler.o
target_objs += $(TARGET)out_lib.o $(TARGET)update_trans.o
target_objs += $(TARGET)update_records.o $(TARGET)update_recovery.o
target_objs += $(TARGET)tgt_grant.o $(TARGET)tgt_fmd.o

ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o
ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o
ptlrpc_objs += llog_net.o llog_client.o llog_server.o import.o ptlrpcd.o
ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o
ptlrpc_objs += sec.o sec_ctx.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o
ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o nrs_delay.o heap.o
ptlrpc_objs += errno.o

nrs_server_objs := nrs_crr.o nrs_orr.o nrs_tbf.o

nodemap_objs := nodemap_handler.o nodemap_lproc.o nodemap_range.o
nodemap_objs += nodemap_idmap.o nodemap_rbtree.o nodemap_member.o
nodemap_objs += nodemap_storage.o

ptlrpc-objs := $(ldlm_objs) $(ptlrpc_objs) $(TARGET)barrier.o
@SERVER_TRUE@ptlrpc-objs += $(target_objs) $(nodemap_objs) $(nrs_server_objs) pack_server.o

@GSS_TRUE@obj-m += gss/

default: all

ldlm_%.c: @LUSTRE@/ldlm/ldlm_%.c
	ln -sf $< $@

l_lock.c: @LUSTRE@/ldlm/l_lock.c
	ln -sf $< $@

tgt_%.c: @LUSTRE@/target/tgt_%.c
	ln -sf $< $@

out_%.c: @LUSTRE@/target/out_%.c
	ln -sf $< $@

barrier.c: @LUSTRE@/target/barrier.c
	ln -sf $< $@

EXTRA_DIST := $(ptlrpc_objs:.o=.c) ptlrpc_internal.h
EXTRA_DIST += $(nodemap_objs:.o=.c) nodemap_internal.h heap.h
EXTRA_DIST += $(nrs_server_objs:.o=.c)
EXTRA_DIST += pack_server.c

EXTRA_PRE_CFLAGS := -I@LUSTRE@/ldlm -I@LUSTRE@/target

@INCLUDE_RULES@
